package com.ControlEscolar.DAOs;



import com.ControlEscolar.Beans.Profile;
import java.util.ArrayList;

public class ProfileDAO extends AbstractDAO <Profile> {

    @Override
    public void add(Profile object) throws DAOException {
                String sql = "INSERT INTO profiles (ProfileName,GradeAuth,PaymentsAuth," +
                        "InscriptionAuth,studentDataAuth," +
                        "CurriculumAuth,AdminAuth)values(\""
               + object.getProfileName()+"\",\""
               + object.getGradeAuth()+"\",\""
               + object.getPaymentsAuth()+"\",\""
               + object.getInscriptionAuth()+"\",\""
               + object.getStudentDataAuth()+"\",\"" 
               + object.getCurriculumAuth()+"\",\""
               + object.getAdminAuth()+"\");";
   // System.out.println(sql);
        try {
            connection.executeUpdate(sql);
        } catch (Exception ex) {
            throw new DAOException();
        }
    }

    @Override
    public int delete(String condition) throws DAOException {
        throw new UnsupportedOperationException("Not supported yet.");
    }

    @Override
    public int update(Profile object) throws DAOException {
        throw new UnsupportedOperationException("Not supported yet.");
    }

    @Override
    public ArrayList<Profile> query() throws DAOException {
         try {
            String sql = "SELECT * FROM profiles";
            return connection.executeQuery(sql, Profile.class);

        } catch (Exception ex) {
            throw new DAOException();

        }
    }
}